/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI.Admin;
import dao.LichChieuPhimDAO;
import java.util.List;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;
import pojo.Lichchieuphim;
/**
 *
 * @author Dang Nhung
 */
public class Admin_FilmScheduleManage extends javax.swing.JPanel {

    private DefaultTableModel model= null;
    List<Lichchieuphim> lichchieuPhims= null; //You must declare at here to use global
    
    /**
     * Creates new form Admin_FilmScheduleManage
     */
    public Admin_FilmScheduleManage() {
        initComponents();
        // So binding data to jtable
        LoadDBJTable();
    }

    
    final public void LoadDBJTable(){
        model = (DefaultTableModel) jtblistofschedule.getModel();
        model.getDataVector().clear(); //Empty data into JTable
        try{
            lichchieuPhims=LichChieuPhimDAO.getLichChieuPhims();
            for(Lichchieuphim lichchieuphim: lichchieuPhims)
            {
                Vector v=new Vector();
                v.addElement(lichchieuphim.getNgayChieu());
                v.addElement(lichchieuphim.getPhongchieu());
                v.addElement(lichchieuphim.getSuatchieu());
                v.addElement(lichchieuphim.getTrangThai());
                model.addRow(v);
            }
            jtblistofschedule.setModel(model);
            
        }catch(Exception ex){
            ex.printStackTrace();
        }
               
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jlbsearchmovie = new javax.swing.JLabel();
        jtxtselectmovie = new javax.swing.JTextField();
        jbtnsearch = new javax.swing.JButton();
        jPanel2 = new javax.swing.JPanel();
        jlbscheduleoffilm = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jtblistofschedule = new javax.swing.JTable();
        jpnroomanage2 = new javax.swing.JPanel();
        jlbmoviename = new javax.swing.JLabel();
        jlbreleasedate = new javax.swing.JLabel();
        jlbroom = new javax.swing.JLabel();
        jlbstateofschedule = new javax.swing.JLabel();
        jtxtmoviename = new javax.swing.JTextField();
        jtxtreleasedate = new javax.swing.JTextField();
        jbtnaddrschedule = new javax.swing.JButton();
        jcbroomstate2 = new javax.swing.JComboBox();
        jbtnreset3 = new javax.swing.JButton();
        jbtncancel3 = new javax.swing.JButton();
        jbtnupdateschedule = new javax.swing.JButton();
        jbtndeleteschedule = new javax.swing.JButton();
        jComboBox2 = new javax.swing.JComboBox();
        jlbshowtime = new javax.swing.JLabel();
        jcbshowtime = new javax.swing.JComboBox();
        jlbscheduleid = new javax.swing.JLabel();
        jtxtscheduleid = new javax.swing.JTextField();

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N

        jlbsearchmovie.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jlbsearchmovie.setText("Search Movie");

        jtxtselectmovie.setFont(new java.awt.Font("Tahoma", 2, 11)); // NOI18N
        jtxtselectmovie.setText("Type the name of movie...");

        jbtnsearch.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtnsearch.setText("Search");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jlbsearchmovie)
                .addGap(18, 18, 18)
                .addComponent(jtxtselectmovie, javax.swing.GroupLayout.PREFERRED_SIZE, 383, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jbtnsearch, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(30, 30, 30))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlbsearchmovie)
                    .addComponent(jtxtselectmovie, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtnsearch))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jlbscheduleoffilm.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
        jlbscheduleoffilm.setText("Schedule of Film");

        jtblistofschedule.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null},
                {null, null, null, null, null}
            },
            new String [] {
                "STT", "Release Date", "Room", "Showtime", "State of Schedule"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.String.class, java.lang.Object.class, java.lang.String.class, java.lang.String.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane1.setViewportView(jtblistofschedule);

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jlbscheduleoffilm, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane1)
                    .addContainerGap()))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jlbscheduleoffilm, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel2Layout.createSequentialGroup()
                    .addGap(46, 46, 46)
                    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(47, Short.MAX_VALUE)))
        );

        jpnroomanage2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jlbmoviename.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbmoviename.setText("Movie's Name");

        jlbreleasedate.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbreleasedate.setText("Release Date");

        jlbroom.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbroom.setText("Room");

        jlbstateofschedule.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbstateofschedule.setText("State of Schedule");

        jbtnaddrschedule.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtnaddrschedule.setText("Add Schedule");

        jcbroomstate2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jbtnreset3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtnreset3.setText("Reset");

        jbtncancel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtncancel3.setText("Cancel");

        jbtnupdateschedule.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtnupdateschedule.setText("Update Schedule");

        jbtndeleteschedule.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jbtndeleteschedule.setText("Delete Schedule");

        jComboBox2.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jlbshowtime.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbshowtime.setText("Showtime");

        jcbshowtime.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));

        jlbscheduleid.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlbscheduleid.setText("Schedule ID");

        javax.swing.GroupLayout jpnroomanage2Layout = new javax.swing.GroupLayout(jpnroomanage2);
        jpnroomanage2.setLayout(jpnroomanage2Layout);
        jpnroomanage2Layout.setHorizontalGroup(
            jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnroomanage2Layout.createSequentialGroup()
                .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnroomanage2Layout.createSequentialGroup()
                        .addGap(28, 28, 28)
                        .addComponent(jbtnreset3, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtnaddrschedule)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtnupdateschedule)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtndeleteschedule)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jbtncancel3, javax.swing.GroupLayout.PREFERRED_SIZE, 95, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpnroomanage2Layout.createSequentialGroup()
                        .addGap(68, 68, 68)
                        .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jlbreleasedate)
                            .addComponent(jlbroom)
                            .addComponent(jlbstateofschedule)
                            .addComponent(jlbmoviename)
                            .addComponent(jlbshowtime)
                            .addComponent(jlbscheduleid))
                        .addGap(37, 37, 37)
                        .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jtxtscheduleid)
                            .addComponent(jtxtmoviename)
                            .addComponent(jtxtreleasedate)
                            .addComponent(jcbroomstate2, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jComboBox2, javax.swing.GroupLayout.Alignment.LEADING, 0, 353, Short.MAX_VALUE)
                            .addComponent(jcbshowtime, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addGap(0, 72, Short.MAX_VALUE))
        );
        jpnroomanage2Layout.setVerticalGroup(
            jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnroomanage2Layout.createSequentialGroup()
                .addGap(14, 14, 14)
                .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jtxtscheduleid)
                    .addComponent(jlbscheduleid))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlbmoviename)
                    .addComponent(jtxtmoviename, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlbreleasedate)
                    .addComponent(jtxtreleasedate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbroom))
                .addGap(18, 18, 18)
                .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jlbshowtime)
                    .addComponent(jcbshowtime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jcbroomstate2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jlbstateofschedule))
                .addGap(18, 18, 18)
                .addGroup(jpnroomanage2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(jbtncancel3)
                    .addComponent(jbtndeleteschedule)
                    .addComponent(jbtnupdateschedule)
                    .addComponent(jbtnreset3)
                    .addComponent(jbtnaddrschedule))
                .addGap(28, 28, 28))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jpnroomanage2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jpnroomanage2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox jComboBox2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JButton jbtnaddrschedule;
    private javax.swing.JButton jbtncancel3;
    private javax.swing.JButton jbtndeleteschedule;
    private javax.swing.JButton jbtnreset3;
    private javax.swing.JButton jbtnsearch;
    private javax.swing.JButton jbtnupdateschedule;
    private javax.swing.JComboBox jcbroomstate2;
    private javax.swing.JComboBox jcbshowtime;
    private javax.swing.JLabel jlbmoviename;
    private javax.swing.JLabel jlbreleasedate;
    private javax.swing.JLabel jlbroom;
    private javax.swing.JLabel jlbscheduleid;
    private javax.swing.JLabel jlbscheduleoffilm;
    private javax.swing.JLabel jlbsearchmovie;
    private javax.swing.JLabel jlbshowtime;
    private javax.swing.JLabel jlbstateofschedule;
    private javax.swing.JPanel jpnroomanage2;
    private javax.swing.JTable jtblistofschedule;
    private javax.swing.JTextField jtxtmoviename;
    private javax.swing.JTextField jtxtreleasedate;
    private javax.swing.JTextField jtxtscheduleid;
    private javax.swing.JTextField jtxtselectmovie;
    // End of variables declaration//GEN-END:variables
}
